#include "../include/head.h"
int mystrtok(char* str,char*data){
    char *token=strtok(str," ");
    printf("token == %s\n",token);

    int num=0;
    if(strcmp(token,"cd")==0){
        num=OP_CD;
    }
    else if(strcmp(token,"ls")==0){
        num=OP_LS;
    }
    else if(strcmp(token,"pwd")==0){
        num=OP_PWD;
    }
    else if(strcmp(token,"mkdir")==0){
        num=OP_MKDIR;
    }
    else if(strcmp(token,"rmdir")==0){
        num=OP_RMDIR;
    }
    else if(strcmp(token,"puts")==0){
        num=OP_PUTS;
    }
    else if(strcmp(token,"gets")==0){
        num=OP_GETS;
    }

    char *restr=strtok(NULL,"");
    if(restr!=NULL){

        strncpy(data, restr, strlen(restr));
        data[strlen(restr)]= '\0';
    }else{
        data[0] = '\0';
    }
    return num;
}
